<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>测试</title>
</head>
<body>
	<button id="test">ckick create img</button>
	<img src="" id="img1">
	<div id ="app"></div>
<script type="text/javascript">
	client_id = "";
	var ws = new WebSocket("ws://119.29.121.140:8282");

	ws.onmessage = function(event){
		var data = event.data;
		var obj = JSON.parse(data);
		if(obj.client_id){
			client_id = obj.client_id;
		    console.log(client_id);
		}
		if(obj.status){
			if(obj.status == 2){
				$("#app").append("<h2>Successful scan code!</h2>");
			}
			if(obj.status == 1){
				$("#app").append("<h2>Successful!</h2>");
			}
		}
		//console.log(client_id);
		//var obj = JSON.parse(data);

		
	}
</script>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">

</script>

<script type="text/javascript">
	
		$('#test').click(function(){
		console.log(client_id);
		$.post("http://www.kaycn.com/pay/pay.php",{
			'client_id':client_id
		},
		function(data,status){
			$('#img1').attr('src',data);
		})
		});
</script>